package com.yixun.qfbao.hander;

import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.yixun.qfbao.api.service.CompanyService;
import com.yixun.qfbao.apidto.ChangeAgencyIndexSwitchReqDto;
import com.yixun.qfbao.apidto.ChangeAgencyIndexSwitchResDto;
import com.yixun.qfbao.dto.base.BaseRequestDTO;
import com.yixun.qfbao.dto.base.BaseResponseDTO;
import com.yixun.qfbao.hander.base.CommonAbstractHander;
import com.yixun.qfbao.model.Company;
import com.yixun.qfbao.model.dto.CompanyDto;
import com.yixun.qfbao.vo.ChangeAgencyIndexSwitchReqVo;
import com.yixun.qfbao.xf.model.enums.ResultEnum;

/**
 * 变更分销首页展示开关
 * 
 *		
 */
@Service("changeAgencyIndexSwitchHander")
public class ChangeAgencyIndexSwitchHander extends CommonAbstractHander {
	private static Logger logger= LoggerFactory.getLogger(ChangeAgencyIndexSwitchHander.class);
	
	@Autowired
	private CompanyService companyService;
	
	@SuppressWarnings("rawtypes")
	@Override
	public BaseResponseDTO doBusiness(BaseRequestDTO reqDto) {
		ChangeAgencyIndexSwitchReqVo req = (ChangeAgencyIndexSwitchReqVo)reqDto;
		ChangeAgencyIndexSwitchReqDto reqDto1 = req.getParams();
		BaseResponseDTO<ChangeAgencyIndexSwitchResDto> res = new BaseResponseDTO<ChangeAgencyIndexSwitchResDto>();
		ChangeAgencyIndexSwitchResDto resDto = new ChangeAgencyIndexSwitchResDto();
		try {
            resDto = companyService.changeAgencyIndexSwitch(reqDto1);
			res.setResData(resDto);
			res.setResult(resDto.getResult());
		} catch (Exception e) {
			logger.error("ChangeAgencyIndexSwitchHander error: {}", e);
			resDto.setResult(ResultEnum.FAIL.getNo());
			resDto.setResultMsg("分销助手无需登陆查看楼盘功能失败");
		}
		return res;
	}
	
}
